﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.ThrongIn.DAL;
using Com.ThrongIn.BE;
using Com.ThrongIn.Utilities;
namespace Com.ThrongIn.BLL
{
    public class ProfileBLL
    {
        #region Properties
        private ProfileDAL  ObjProfileDAL
        {
            get
            {                
                return new ProfileDAL();
            }
        }
        #endregion

            /// <summary>
        /// Get Latest Profiles.
        /// </summary>
        /// <returns></returns>
        public List<Profile> GetLatestProfiles()
        {
            return ObjProfileDAL.GetLatestProfiles();
        }
        
        /// <summary>
        /// Get Latest Profiles by profile id
        /// </summary>
        /// <returns></returns>
        public List<Profile> GetLatestProfiles(int parentId, int limit, int offset, out int page)
        {
            return ObjProfileDAL.GetLatestProfiles(parentId,limit,offset, out page);
        }
        /// <summary>
        /// Get Latest Profiles by keywords
        /// </summary>
        /// <returns></returns>
        public List<Profile> GetProfilesByKeywords(string keywords, bool includeDesc = false)
        {
            return ObjProfileDAL.GetProfilesByKeywords(keywords,includeDesc);
        }
        /// <summary>
        /// Get Profile detail
        /// </summary>
        /// <param name="profileId"></param>
        /// <returns></returns>
        public Profile GetProfileDetail(Int64 profileId)
        {
            Profile profile = ObjProfileDAL.GetProfileDetail(profileId);
            //if (profile != null && String.IsNullOrEmpty(profile.Profile_Image))
            //    profile.Profile_Image = "~/Images/No-Image-Available_small.gif";
            return profile;
        }
         /// <summary>
        /// Get Profile Images
        /// </summary>
        /// <param name="profileId"></param>
        /// <returns></returns>
        public List<File> GetProfileFiles(Int64 profileId,int typeId)
        {
            return ObjProfileDAL.GetProfileFiles(profileId, typeId);
        }
        /// <summary>
        /// Get Comments on a file
        /// </summary>
        /// <param name="fileId"></param>
        /// <returns></returns>
        public List<FileComment> GetFileComments(Int64 fileId, Int64 commentId)
        {
            return ObjProfileDAL.GetFileComments(fileId, commentId);
        }
        /// <summary>
       /// Add file Comment
       /// </summary>
       /// <param name="fileComment"></param>
        public Int64 AddFileComments(FileComment fileComment)
        {
           return ObjProfileDAL.AddFileComments(fileComment);
        }
        /// <summary>
        /// Get File by Id and type
        /// </summary>
        /// <param name="fileId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public File GetFileByType(Int64 fileId)
        {
            return ObjProfileDAL.GetFileByType(fileId);
        }
        /// <summary>
        /// Get Profile comments
        /// </summary>
        /// <param name="fileId"></param>
        /// <returns></returns>
        public List<ProfileComment> GetProfileComments(Int64 profileId, Int64 commentId)
        {
            return ObjProfileDAL.GetProfileComments(profileId, commentId);
        }
        /// <summary>
        /// Add file Comment
        /// </summary>
        /// <param name="fileComment"></param>
        public Int64 AddProfileComments(ProfileComment profileComment)
        {
            return ObjProfileDAL.AddProfileComments(profileComment);
        }
       /// <summary>
       /// 
       /// </summary>
       /// <param name="profileId"></param>
       /// <param name="ipaddress"></param>
        public void AddProfileVisitLog(Int64 profileId, string ipaddress)
        {
            ObjProfileDAL.AddProfileVisitLog(profileId, ipaddress);
        }
         /// <summary>
        /// Get Hot Profiles by category id
        /// </summary>
        /// <returns></returns>
        public List<Profile> GetHotProfiles(Int64 categoryId)
        {
            return ObjProfileDAL.GetHotProfiles(categoryId);
        }
    }
}
